<script setup>
import { provide, ref } from 'vue'
import HmSon3 from './components/HmSon3.vue'
const num = ref(999)
provide('xxx', num)

function fn (str) {
  console.log(str)
}
provide('fn', fn)
/*
 provide与inject：高阶组件向低阶组件传值
 provide:传
   import {provide} from 'vue'
   provide('属性名',属性值)
 inject:收
   const 变量名=inject('属性名')
*/
</script>

<template>
  <div class="page">
    <h3>我是父组件</h3>
    <h3>{{ num }}</h3>
    <hr />
    <HmSon3></HmSon3>
  </div>
</template>

<style scoped></style>
